package com.example.echars;

import com.alibaba.fastjson.JSON;
import com.example.echars.model.ChannelFillRate;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

public class Demo {

    public static void main(String[] args) {
        String[] channels = new String[]{"shouwang", "mengwang", " jumeng", "zhongdingdongli", "twilio", "telesign", "ali", "sendgrid", "aws"};
        List<String> channelList = Arrays.asList(channels);
        String[] templates = new String[]{"user","sys","role","category","pro", "attr"};
        List<String> templateList = Arrays.asList(templates);
        String[] sites = new String[]{"okx","okcoin","oklin","other"};
        List<String> siteList = Arrays.asList(sites);
        Random random = new Random();
        List<ChannelFillRate> list = new ArrayList<>();
        for (int i = 0; i < siteList.size(); i++) {
            for (int j = 0; j < templateList.size(); j++) {
                for (int x = 0; x < channelList.size(); x++) {
                    ChannelFillRate channelFillRate = new ChannelFillRate();
                    channelFillRate.setChannelId(x);
                    channelFillRate.setChannelName(channelList.get(x));
                    int nextInt = random.nextInt(1000);
                    channelFillRate.setSuccessCount(nextInt);
                    int nextInt1 = random.nextInt(600);
                    channelFillRate.setErrorCount(nextInt1);
                    float v = (float) nextInt / (float) (nextInt + nextInt1);
                    channelFillRate.setFillRate(v);
                    String site = siteList.get(i);
                    String template = templateList.get(j);
                    channelFillRate.setTemplate(site + "_" + template + "_alarm_template_notification");
                    list.add(channelFillRate);
                }
            }
        }

        System.out.println(JSON.toJSONString(list));
    }
}

